<?php if ( ! defined('BASEPATH')) exit('No direct script access allowed');

class Report extends arfaController {

	public function __construct(){
		parent::__construct();
		$this->load->helper('general');
		$this->cekLogin();
		$this->load->model("m_kuesioner_model");
		$this->load->model("m_ijin_model");
		$this->load->model("m_tindak_lanjut_model");
		$this->load->model("m_kritik_saran_model");
		$this->load->model("m_tanya_model");
	}
	
	public function cetak_report(){
		$img = imagegrabscreen();
		imagepng($img, 'screenshot.png');
		$data["tgl_awal"]		= date("Y-m-d",strtotime($this->input->post("tgl_awal")));
		$data["tgl_akhir"]		= date("Y-m-d",strtotime($this->input->post("tgl_akhir")));	
		
		$data["laporan_hasil"] 		= $this->m_kuesioner_model->get_chart($data["tgl_awal"],$data["tgl_akhir"]);
		$data["laporan_jk"] 		= $this->m_kuesioner_model->get_jenis_kelamin($data["tgl_awal"],$data["tgl_akhir"]);
		$data["laporan_usia"] 		= $this->m_kuesioner_model->get_chart_usia($data["tgl_awal"],$data["tgl_akhir"]);
		$data["laporan_pendidikan"] = $this->m_kuesioner_model->get_chart_pendidikan($data["tgl_awal"],$data["tgl_akhir"]);
		$data["laporan_pekerjaan"] 	= $this->m_kuesioner_model->get_chart_perkerjaan($data["tgl_awal"],$data["tgl_akhir"]);
		$data["laporan_izin"] 		= $this->m_kuesioner_model->get_chart_izin($data["tgl_awal"],$data["tgl_akhir"]);
		$data["laporan_pertanyaan"] = $this->m_kuesioner_model->get_chart_bar($data["tgl_awal"],$data["tgl_akhir"]);
		$data["status"]				= $this->input->post("status");
		$this->load->library("phpexcel");
		$this->load->library("PHPExcel/IOFactory");
		$this->load->view("report_global_excel",$data,true);	
	}
	
	public function r_global(){
		$this->form_validation->set_rules("tgl_awal","Tanggal Awal","required");
		$this->form_validation->set_rules("tgl_akhir","Tanggal Akhir","required");
		$this->form_validation->set_rules("jns_laporan", "Jenis Laporan", "required");
		
		if($this->form_validation->run() == FALSE){
			$data["content"]	= $this->load->view("form_r_global","",true);
			$data["menu"] 		= "admin";
			$this->load->view("main",$data);
		} else {
			$data["tgl_awal"]		= date("Y-m-d",strtotime($this->input->post("tgl_awal")));
			$data["tgl_akhir"]		= date("Y-m-d",strtotime($this->input->post("tgl_akhir")));		
			if( $this->input->post("jns_laporan") == "chart" ) {
				$data["query"]	= $this->m_kuesioner_model->get_chart(date("Y-m-d",strtotime($this->input->post("tgl_awal"))),date("Y-m-d",strtotime($this->input->post("tgl_akhir"))));
				$data["query3"]	= $this->m_kuesioner_model->get_chart_usia(date("Y-m-d",strtotime($this->input->post("tgl_awal"))),date("Y-m-d",strtotime($this->input->post("tgl_akhir"))));
				$data["query4"]	= $this->m_kuesioner_model->get_chart_perkerjaan(date("Y-m-d",strtotime($this->input->post("tgl_awal"))),date("Y-m-d",strtotime($this->input->post("tgl_akhir"))));
				$data["query5"]	= $this->m_kuesioner_model->get_chart_pendidikan(date("Y-m-d",strtotime($this->input->post("tgl_awal"))),date("Y-m-d",strtotime($this->input->post("tgl_akhir"))));
				$data["query6"]	= $this->m_kuesioner_model->get_chart_izin(date("Y-m-d",strtotime($this->input->post("tgl_awal"))),date("Y-m-d",strtotime($this->input->post("tgl_akhir"))));
				$data["query2"]	= $this->m_kuesioner_model->get_chart_bar(date("Y-m-d",strtotime($this->input->post("tgl_awal"))),date("Y-m-d",strtotime($this->input->post("tgl_akhir"))));
				$data["content"]	= $this->load->view("chart_r_global",$data,true);
				$data["menu"] 		= "admin";
				$this->load->view("main",$data);			
			} elseif( $this->input->post("jns_laporan") == "excel") {
				$data["laporan_hasil"] 		= $this->m_kuesioner_model->get_chart($data["tgl_awal"],$data["tgl_akhir"]);
				$data["laporan_jk"] 		= $this->m_kuesioner_model->get_jenis_kelamin($data["tgl_awal"],$data["tgl_akhir"]);
				$data["laporan_usia"] 		= $this->m_kuesioner_model->get_chart_usia($data["tgl_awal"],$data["tgl_akhir"]);
				$data["laporan_pendidikan"] = $this->m_kuesioner_model->get_chart_pendidikan($data["tgl_awal"],$data["tgl_akhir"]);
				$data["laporan_pekerjaan"] 	= $this->m_kuesioner_model->get_chart_perkerjaan($data["tgl_awal"],$data["tgl_akhir"]);
				$data["laporan_izin"] 		= $this->m_kuesioner_model->get_chart_izin($data["tgl_awal"],$data["tgl_akhir"]);
				$data["laporan_pertanyaan"] = $this->m_kuesioner_model->get_chart_bar($data["tgl_awal"],$data["tgl_akhir"]);
				$data["status"]				= 2;
				$this->load->library("phpexcel");
				$this->load->library("PHPExcel/IOFactory");
				$this->load->view("report_global_excel",$data,true);			
			} elseif( $this->input->post("jns_laporan") == "cne"){
				$data["query"]	= $this->m_kuesioner_model->get_chart(date("Y-m-d",strtotime($this->input->post("tgl_awal"))),date("Y-m-d",strtotime($this->input->post("tgl_akhir"))));
				$data["query3"]	= $this->m_kuesioner_model->get_chart_usia(date("Y-m-d",strtotime($this->input->post("tgl_awal"))),date("Y-m-d",strtotime($this->input->post("tgl_akhir"))));
				$data["query4"]	= $this->m_kuesioner_model->get_chart_perkerjaan(date("Y-m-d",strtotime($this->input->post("tgl_awal"))),date("Y-m-d",strtotime($this->input->post("tgl_akhir"))));
				$data["query5"]	= $this->m_kuesioner_model->get_chart_pendidikan(date("Y-m-d",strtotime($this->input->post("tgl_awal"))),date("Y-m-d",strtotime($this->input->post("tgl_akhir"))));
				$data["query6"]	= $this->m_kuesioner_model->get_chart_izin(date("Y-m-d",strtotime($this->input->post("tgl_awal"))),date("Y-m-d",strtotime($this->input->post("tgl_akhir"))));
				$data["query2"]	= $this->m_kuesioner_model->get_chart_bar(date("Y-m-d",strtotime($this->input->post("tgl_awal"))),date("Y-m-d",strtotime($this->input->post("tgl_akhir"))));
				$data["tgl_awal"]		= date("Y-m-d",strtotime($this->input->post("tgl_awal")));
				$data["tgl_akhir"]		= date("Y-m-d",strtotime($this->input->post("tgl_akhir")));	
				$data["status"]			= 1;
				$data["content"] = $this->load->view("v_report_global",$data,true);
				$this->load->view("main_report_cne",$data);
			}
		}
	}

	public function r_global_perdinas(){
		$this->form_validation->set_rules("tgl_awal","Tanggal Awal","required");
		$this->form_validation->set_rules("tgl_akhir","Tanggal Akhir","required");
		if($this->form_validation->run() == FALSE){
			$data["menu"]		= "admin";
			$data["content"]	= $this->load->view("form_r_global_perdinas",$data,true);
			$this->load->view("main",$data);
		} else {
			$query = $this->m_ijin_model->get_by("STATUS","1");
			$data["list_izin"]			= $query;
			$a=0;
			foreach ($query as $row) {
				$data["query_".$a."_1"]	= $this->m_kuesioner_model->get_chart_perdinas(date("Y-m-d",strtotime($this->input->post("tgl_awal"))),date("Y-m-d",strtotime($this->input->post("tgl_akhir"))),$query[$a]["ID_IJIN"]);
				$data["query_".$a."_2"]	= $this->m_kuesioner_model->get_chart_bar_perdinas(date("Y-m-d",strtotime($this->input->post("tgl_awal"))),date("Y-m-d",strtotime($this->input->post("tgl_akhir"))),$query[$a]["ID_IJIN"]);
				$data["query_".$a."_3"]	= $this->m_kuesioner_model->get_chart_usia_perdinas(date("Y-m-d",strtotime($this->input->post("tgl_awal"))),date("Y-m-d",strtotime($this->input->post("tgl_akhir"))),$query[$a]["ID_IJIN"]);
				$data["query_".$a."_4"]	= $this->m_kuesioner_model->get_chart_perkerjaan_perdinas(date("Y-m-d",strtotime($this->input->post("tgl_awal"))),date("Y-m-d",strtotime($this->input->post("tgl_akhir"))),$query[$a]["ID_IJIN"]);
				$data["query_".$a."_5"]	= $this->m_kuesioner_model->get_chart_pendidikan_perdinas(date("Y-m-d",strtotime($this->input->post("tgl_awal"))),date("Y-m-d",strtotime($this->input->post("tgl_akhir"))),$query[$a]["ID_IJIN"]);
				$data["query_".$a."_6"]	= $this->m_kuesioner_model->get_chart_izin_perdinas(date("Y-m-d",strtotime($this->input->post("tgl_awal"))),date("Y-m-d",strtotime($this->input->post("tgl_akhir"))),$query[$a]["ID_IJIN"]);
				$a++;
			}
			// dump($data);
			$data["content"]	= $this->load->view("chart_r_global_perdinas",$data,true);
			$data["menu"] 	 	= "admin";
			$this->load->view("main",$data);
		}
	}
	
	public function r_global_perdinas_excel(){
		$this->form_validation->set_rules("tgl_awal", "Tanggal Awal", "required");
		$this->form_validation->set_rules("tgl_akhir", "Tanggal Akhir", "required");
		$this->form_validation->set_rules("izin", "Jenis Perizinan", "required");
		
		if( $this->form_validation->run() == FALSE ){
			$data["menu"]		= "admin";
			$data["content"]	= $this->load->view("form_r_global_perdinas_excel",$data,true);
			$this->load->view("main",$data);
		} else {
			$data["perizinan"]  = $this->input->post("izin");

			$query = $this->m_ijin_model->get_nama_perizinan($data["perizinan"]);
			$data["nama_perizinan"] = $query[0]["NAMA_IJIN"];
						
			$data["tgl_awal"]	= date("Y-m-d",strtotime($this->input->post("tgl_awal")));
			$data["tgl_akhir"]	= date("Y-m-d",strtotime($this->input->post("tgl_akhir")));	
			
			$data["laporan_hasil"]	= $this->m_kuesioner_model->get_chart_perdinas(date("Y-m-d",strtotime($this->input->post("tgl_awal"))),date("Y-m-d",strtotime($this->input->post("tgl_akhir"))),$data["perizinan"]);
			$data["laporan_pertanyaan"]	= $this->m_kuesioner_model->get_chart_bar_perdinas(date("Y-m-d",strtotime($this->input->post("tgl_awal"))),date("Y-m-d",strtotime($this->input->post("tgl_akhir"))),$data["perizinan"]);
			$data["laporan_usia"]	= $this->m_kuesioner_model->get_chart_usia_perdinas(date("Y-m-d",strtotime($this->input->post("tgl_awal"))),date("Y-m-d",strtotime($this->input->post("tgl_akhir"))),$data["perizinan"]);
			$data["laporan_pekerjaan"]	= $this->m_kuesioner_model->get_chart_perkerjaan_perdinas(date("Y-m-d",strtotime($this->input->post("tgl_awal"))),date("Y-m-d",strtotime($this->input->post("tgl_akhir"))),$data["perizinan"]);
			$data["laporan_pendidikan"]	= $this->m_kuesioner_model->get_chart_pendidikan_perdinas(date("Y-m-d",strtotime($this->input->post("tgl_awal"))),date("Y-m-d",strtotime($this->input->post("tgl_akhir"))),$data["perizinan"]);
			$data["laporan_izin"]	= $this->m_kuesioner_model->get_chart_izin_perdinas(date("Y-m-d",strtotime($this->input->post("tgl_awal"))),date("Y-m-d",strtotime($this->input->post("tgl_akhir"))),$data["perizinan"]);	
			
			$this->load->library("phpexcel");
			$this->load->library("PHPExcel/IOFactory");
			$this->load->view("report_global_perdinas_excel",$data,true);		
		}
	}

	public function r_dinas(){
		$this->form_validation->set_rules("tgl_awal","Tanggal Awal","required");
		$this->form_validation->set_rules("tgl_akhir","Tanggal Akhir","required");
		$this->form_validation->set_rules("jns_laporan", "Jenis Laporan", "required");	

		if($this->form_validation->run() == FALSE){
			$data["content"]= $this->load->view("form_r_dinas","",true);
			$data["menu"]	= "admin";
			$this->load->view("main",$data);
		} else {
			$this->load->model(array("m_ijin_model","m_tanya_model"));
			$data["tgl_awal"]	= date("Y-m-d",strtotime($this->input->post("tgl_awal")));
			$data["tgl_akhir"]	= date("Y-m-d",strtotime($this->input->post("tgl_akhir")));
			$data["tanya"]	= $this->m_tanya_model->get_by(array("STATUS"=>1));
			$data["ijin"]	= $this->m_ijin_model->get_by(array("STATUS"=>1));				

			// untuk chart
			if ( $this->input->post("jns_laporan") == "chart" ) {
				$data["content"]	= $this->load->view("chart_r_dinas",$data,true);
				$data["menu"] 		= "admin";
				$this->load->view("main",$data);
			} else {
				$data["tanya2"] = $this->m_tanya_model->get_jumlah_pertanyaan($data["tgl_awal"], $data["tgl_akhir"]);
				$this->load->library("phpexcel");
				$this->load->library("PHPExcel/IOFactory");
				$this->load->view("report_dinas_excel",$data,true);
				// dump($data);
			}
		}
	}

	public function r_periode(){
		$this->form_validation->set_rules("tgl_awal","Tanggal Awal","required");
		$this->form_validation->set_rules("tgl_akhir","Tanggal Akhir","required");
		$this->form_validation->set_rules("jns_laporan", "Jenis Laporan", "required");	
		
		if($this->form_validation->run() == FALSE){
			$data["content"]= $this->load->view("form_r_periode","",true);
			$data["menu"]	= "admin";
			$this->load->view("main",$data);
		} else {
			$this->load->model(array("m_tanya_model","m_kuesioner_model"));
			$data["tgl_awal"]	= date("Y-m-d",strtotime($this->input->post("tgl_awal")));
			$data["tgl_akhir"]	= date("Y-m-d",strtotime($this->input->post("tgl_akhir")));
			$data["kuesioner"]	= $this->m_tanya_model->get_nilai_periode($data["tgl_awal"],$data["tgl_akhir"]);
			$data["tanya"]		= $this->m_tanya_model->get_by(array("STATUS"=>1));

			// untuk chart
			if( $this->input->post("jns_laporan") == "chart" ) {
				$data["content"]	= $this->load->view("chart_r_periode",$data,true);
				$data["menu"] 		= "admin";
				$this->load->view("main",$data);
			} else {
				$this->load->library('PHPExcel');
				$this->load->library('PHPExcel/IOFactory');
				//$this->load->view("report_periode_excel",$data,true);
				
				$objPHPExcel = new PHPExcel();
				
				$objPHPExcel->getSheet(0)->setTitle('Report Global Perperiode');
				$objPHPExcel->getProperties()->setTitle("title")->setDescription("description");
				
				//pengaturan sheet aktif
				$objPHPExcel->setActiveSheetIndex(0);
				
				//merge cell pada excel
				$objPHPExcel->setActiveSheetIndex(0)->mergeCells('A1:D1');
				$objPHPExcel->setActiveSheetIndex(0)->mergeCells('A3:A4');
				$objPHPExcel->setActiveSheetIndex(0)->mergeCells('B3:C4');
				$objPHPExcel->setActiveSheetIndex(0)->mergeCells('D3:D4');
				$objPHPExcel->setActiveSheetIndex(0)->mergeCells('B5:B17');
				
				//set lebar cell manual
				$objPHPExcel->getActiveSheet()->getColumnDimension('A')->setWidth(5);
				$objPHPExcel->getActiveSheet()->getColumnDimension('B')->setWidth(20);
				$objPHPExcel->getActiveSheet()->getColumnDimension('C')->setWidth(20);
				$objPHPExcel->getActiveSheet()->getColumnDimension('D')->setWidth(20);
					
				
				//pengaturan aligment HORIZONTAL dan VERTICAL ke CENTER
				$objPHPExcel->getDefaultStyle()->getAlignment()->setHorizontal(PHPExcel_Style_Alignment::HORIZONTAL_CENTER);
				$objPHPExcel->getDefaultStyle()->getAlignment()->setVertical(PHPExcel_Style_Alignment::VERTICAL_CENTER);
				
				//Set warna cell
				$objPHPExcel->setActiveSheetIndex(0)->getStyle('A3:D4')->applyFromArray(array('fill' => array('type' => PHPExcel_Style_Fill::FILL_SOLID,'color' => array('rgb' => 'FFFF00'))));
				$objPHPExcel->setActiveSheetIndex(0)->getStyle('B5')->applyFromArray(array('fill' => array('type' => PHPExcel_Style_Fill::FILL_SOLID,'color' => array('rgb' => 'F4B084'))));
				$objPHPExcel->setActiveSheetIndex(0)->getStyle('C5:D5')->applyFromArray(array('fill' => array('type' => PHPExcel_Style_Fill::FILL_SOLID,'color' => array('rgb' => 'AEAAAA'))));
				$objPHPExcel->setActiveSheetIndex(0)->getStyle('C7:D7')->applyFromArray(array('fill' => array('type' => PHPExcel_Style_Fill::FILL_SOLID,'color' => array('rgb' => 'AEAAAA'))));
				$objPHPExcel->setActiveSheetIndex(0)->getStyle('C9:D9')->applyFromArray(array('fill' => array('type' => PHPExcel_Style_Fill::FILL_SOLID,'color' => array('rgb' => 'AEAAAA'))));
				$objPHPExcel->setActiveSheetIndex(0)->getStyle('C11:D11')->applyFromArray(array('fill' => array('type' => PHPExcel_Style_Fill::FILL_SOLID,'color' => array('rgb' => 'AEAAAA'))));
				$objPHPExcel->setActiveSheetIndex(0)->getStyle('C13:D13')->applyFromArray(array('fill' => array('type' => PHPExcel_Style_Fill::FILL_SOLID,'color' => array('rgb' => 'AEAAAA'))));
				$objPHPExcel->setActiveSheetIndex(0)->getStyle('C15:D15')->applyFromArray(array('fill' => array('type' => PHPExcel_Style_Fill::FILL_SOLID,'color' => array('rgb' => 'AEAAAA'))));
				$objPHPExcel->setActiveSheetIndex(0)->getStyle('C17:D17')->applyFromArray(array('fill' => array('type' => PHPExcel_Style_Fill::FILL_SOLID,'color' => array('rgb' => 'AEAAAA'))));
				
				//Set border pada cell
				foreach(range(3,17) as $row)
				{
					foreach(range('A','D') as $col) 
					{				  
						$cell = $col.$row;
						$objPHPExcel->getActiveSheet()->getStyle($cell)->getBorders()->getTop()->setBorderStyle(PHPExcel_Style_Border::BORDER_THIN);
						$objPHPExcel->getActiveSheet()->getStyle($cell)->getBorders()->getBottom()->setBorderStyle(PHPExcel_Style_Border::BORDER_THIN);
						$objPHPExcel->getActiveSheet()->getStyle($cell)->getBorders()->getLeft()->setBorderStyle(PHPExcel_Style_Border::BORDER_THIN);
						$objPHPExcel->getActiveSheet()->getStyle($cell)->getBorders()->getRight()->setBorderStyle(PHPExcel_Style_Border::BORDER_THIN);
					}
				}
			
				//Set size font cell
				$objPHPExcel->getActiveSheet()->getStyle('A1')->getFont()->setSize(16);
				
				//Set boldfont cell
				$objPHPExcel->getActiveSheet()->getStyle('A3:B3')->getFont()->setBold(true);
				
				//Set title
				$objPHPExcel->getActiveSheet()->setCellValue('A1', "Report Global Periode ");	
				$objPHPExcel->getActiveSheet()->setCellValue('A3', "No.");
				$objPHPExcel->getActiveSheet()->setCellValue('B3', "Karakteristik");
				$objPHPExcel->getActiveSheet()->setCellValue('D3', "Prosentase");
				$objPHPExcel->getActiveSheet()->setCellValue('D3', "Prosentase");
				$numbs = 1;
				foreach(range(5,16) as $row)
				{
					$objPHPExcel->getActiveSheet()->setCellValue('B'.$row, $numbs++);
				}
				$objPHPExcel->getActiveSheet()->setCellValue('B5', "Pertanyaan");
				$numbss = 1;
				foreach(range(5,17) as $row)
				{
					$objPHPExcel->getActiveSheet()->setCellValue('C'.$row, "Pertanyaan-".$numbss++);
					$numbs++;
				}
				
				
				$pertanyaan	= $this->m_tanya_model->get_nilai_pertanyaan($data["tgl_awal"],$data["tgl_akhir"]);
				$no = 5;
				foreach($pertanyaan as $row)
				{
					$objPHPExcel->getActiveSheet()->setCellValue('D'.$no, $row["TOTAL_NILAI"]);
					$no++;
				}
				
				
				$objWriter = IOFactory::createWriter($objPHPExcel, 'Excel5');
				header('Content-Type: application/vnd.ms-excel');
				header('Content-Disposition: attachment;filename="Report Per Periode.xls"');
				header('Cache-Control: max-age=0');
				$objWriter->save('php://output');
			}	
		}
	}

	public function r_ikm(){
		$this->form_validation->set_rules("tgl_awal", "Tanggal Awal", "required");
		$this->form_validation->set_rules("tgl_akhir", "Tanggal Akhir", "required");
		$this->form_validation->set_rules("laporan", "Jenis Laporan IKM", "required");

		if( $this->form_validation->run() == FALSE ) {
			$data["content"]= $this->load->view("form_r_ikm","",true);
			$data["menu"]	= "admin";
			$this->load->view("main",$data);
		} else {
			$data["tgl_awal"]		= date("Y-m-d",strtotime($this->input->post("tgl_awal")));
			$data["tgl_akhir"]		= date("Y-m-d",strtotime($this->input->post("tgl_akhir")));
			if( $this->input->post("laporan") == "karakteristik" ) {
				$data["laporan_jk"] 		= $this->m_kuesioner_model->get_jenis_kelamin($data["tgl_awal"],$data["tgl_akhir"]);
				$data["laporan_usia"] 		= $this->m_kuesioner_model->get_chart_usia($data["tgl_awal"],$data["tgl_akhir"]);
				$data["laporan_pendidikan"] = $this->m_kuesioner_model->get_chart_pendidikan($data["tgl_awal"],$data["tgl_akhir"]);
				$data["laporan_pekerjaan"] 	= $this->m_kuesioner_model->get_chart_perkerjaan($data["tgl_awal"],$data["tgl_akhir"]);
				$data["laporan_izin"] 		= $this->m_kuesioner_model->get_chart_izin($data["tgl_awal"],$data["tgl_akhir"]);
				$this->load->library("phpexcel");
				$this->load->library("PHPExcel/IOFactory");
				$this->load->view("report_ikm_karakteristik",$data,true);
			} else {
				$data["laporan"]	= $this->m_tanya_model->get_report_ikm_unsur($data["tgl_awal"],$data["tgl_akhir"]);
				$this->load->library("phpexcel");
				$this->load->library("PHPExcel/IOFactory");
				$this->load->view("report_ikm_unsur",$data,true);
			}
		}
	}

	public function r_tindak_lanjut() {
		$this->form_validation->set_rules("tgl_awal", "Tanggal Awal", "required");
		$this->form_validation->set_rules("tgl_akhir", "Tanggal Akhir", "required");
		$this->form_validation->set_rules("sord", "Pengurutan", "required");

		if( $this->form_validation->run() == FALSE ) {
			$data["content"]= $this->load->view("form_r_tindak_lanjut","",true);
			$data["menu"]	= "admin";
			$this->load->view("main",$data);
		} else {
			$data["tgl_awal"]	= date("Y-m-d",strtotime($this->input->post("tgl_awal")));
			$data["tgl_akhir"]	= date("Y-m-d",strtotime($this->input->post("tgl_akhir")));
			$data["sord"] 		= ($this->input->post("sord") == "tanggal_dibuat") ? "tanggal_dibuat" : "deadline" ;
			$data["jumlah"]		= $this->m_tindak_lanjut_model->get_jumlah($data["tgl_awal"],$data["tgl_akhir"],$data["sord"]);
			$data["content"]	= $this->load->view("table_r_tindak_lanjut",$data,true);
			$data["menu"] 		= "admin";
			$this->load->view("main",$data);
		}
	}

	public function r_kritik_saran() {
		$this->form_validation->set_rules("tgl_awal", "Tanggal Awal", "required");
		$this->form_validation->set_rules("tgl_akhir", "Tanggal Akhir", "required");

		if( $this->form_validation->run() == FALSE ) {
			$data["content"]= $this->load->view("form_r_kritik_saran","",true);
			$data["menu"]	= "admin";
			$this->load->view("main",$data);
		} else {
			$data["tgl_awal"]		= date("Y-m-d",strtotime($this->input->post("tgl_awal")));
			$data["tgl_akhir"]		= date("Y-m-d",strtotime($this->input->post("tgl_akhir")));
			$data["jumlah"] 		= $this->m_kritik_saran_model->get_jumlah($data["tgl_awal"],$data["tgl_akhir"]);
			$data["content"]		= $this->load->view("table_r_kritik_saran",$data,true);
			$data["menu"] 			= "admin";
			// dump($data);
			$this->load->view("main",$data);
		}
	}
	
	public function blank_page($url)
	{
		redirect("report/$url");
	}
}